from django.db import models
from django.utils.timezone import now


class PublishModel(models.Model):
    id = models.CharField(db_column="c_id", max_length=32, verbose_name=u"主键", primary_key=True, blank=False,
                          null=False)
    publish_date = models.DateTimeField(db_column="c_publish_date", default=now)
    product_number = models.CharField(db_column="c_product_number", max_length=32, blank=False, null=False)
    description = models.CharField(db_column="c_description", max_length=32, blank=False, null=False)
    file_type = models.IntegerField(db_column="c_file_type", null=False)
    file_name = models.CharField(db_column="c_file_name", max_length=100, verbose_name="文件名称", blank=False, null=False)
    is_delete = models.BooleanField(db_column="c_is_delete", default=False)

    class Meta:
        db_table = "t_publish"
        verbose_name = "发布资料表"
        verbose_name_plural = verbose_name
        ordering = ["-publish_date"]


class PublishDetialModel(models.Model):
    id = models.CharField(db_column="c_id", max_length=32, verbose_name=u"主键", primary_key=True, blank=False,
                          null=False)
    publish_id = models.CharField(db_column="c_publish_id", max_length=32, blank=False, null=False)
    product_number = models.CharField(db_column="c_product_number", max_length=500, verbose_name="品名", blank=False,
                                      null=False)
    file_name = models.CharField(db_column="c_file_name", max_length=100, verbose_name="文件名称", blank=False, null=False)
    file_path = models.CharField(db_column="c_file_path", max_length=100, verbose_name="文件路径", blank=False, null=False)
    file_type = models.IntegerField(db_column="c_file_type", null=False)
    hard_version = models.CharField(db_column="c_hard_version", max_length=32, verbose_name=u"硬件版本", blank=True,
                                    null=True)
    version = models.CharField(db_column="c_version", max_length=100, verbose_name="svn的最新版本", blank=False, null=False)
    description = models.CharField(db_column="c_description", max_length=32, blank=False, null=False)
    is_delete = models.BooleanField(db_column="c_is_delete", default=False)
    create_date = models.DateTimeField(db_column="c_create_date", default=now)
    update_date = models.DateTimeField(db_column="c_update_date", default=now)

    class Meta:
        db_table = "t_publish_detial"
        verbose_name = "发布资料表"
        verbose_name_plural = verbose_name
        ordering = ["-create_date"]


class ToolProductModel(models.Model):
    id = models.CharField(db_column="c_id", max_length=32, verbose_name=u"主键", primary_key=True, blank=False,
                          null=False)
    product_number = models.CharField(db_column="c_product_number", max_length=500, verbose_name="品名", blank=False,
                                      null=False)
    file_name = models.CharField(db_column="c_file_name", max_length=100, verbose_name="文件名称", blank=False, null=False)
    file_path = models.CharField(db_column="c_file_path", max_length=100, verbose_name="文件路径", blank=False, null=False)
    version = models.CharField(db_column="c_version", max_length=100, verbose_name="svn的最新版本", blank=False, null=False)
    is_delete = models.BooleanField(db_column="c_is_delete", default=False)
    create_date = models.DateTimeField(db_column="c_create_date", default=now)
    update_date = models.DateTimeField(db_column="c_update_date", default=now)

    class Meta:
        db_table = "t_tool_product"
        verbose_name = "发布资料表"
        verbose_name_plural = verbose_name
        ordering = ["-create_date"]


class EmailModel(models.Model):
    id = models.CharField(db_column="c_id", max_length=32, verbose_name=u"主键", primary_key=True, blank=False,
                          null=False)
    email_name = models.CharField(db_column="c_email_name", max_length=500, verbose_name="品名", blank=False,
                                  null=False)
    is_active = models.BooleanField(db_column="c_is_active", default=True)
    is_delete = models.BooleanField(db_column="c_is_delete", default=False)
    create_date = models.DateTimeField(db_column="c_create_date", default=now)
    update_date = models.DateTimeField(db_column="c_update_date", default=now)

    class Meta:
        db_table = "t_email"
        verbose_name = "发布资料表"
        verbose_name_plural = verbose_name
        ordering = ["-create_date"]
